﻿using WindowsGame.Manager;

namespace WindowsGame
{
	/// <summary>
	/// GameFactory is responsible for constructing the GameManager.
	/// </summary>
	public static class GameFactory
	{
		private static IGameManager gameManager;

		public static IGameManager GetGameManager()
		{
			if (null == gameManager)
			{
				IContentManager contentManager = new ContentManager();
				IGraphicsManager graphicsManager = new GraphicsManager();
				ICameraManager cameraManager = new CameraManager(graphicsManager);
				IGameObjectManager gameObjectManager = new GameObjectManager(cameraManager, contentManager);
				IScreenManager screenManager = new ScreenManager(gameObjectManager, graphicsManager);

				gameManager = new GameManager(
					cameraManager,
					contentManager,
					gameObjectManager,
					graphicsManager,
					screenManager
					);
			}

			return gameManager;
		}
	}
}
